package com.godyao.mall.rabbitmq.repository;

import com.godyao.mall.rabbitmq.model.MqMsg;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * @author godyao
 * @date 2022/4/3
 */
public interface MqMsgRepository extends CrudRepository<MqMsg, Long> {
    /**
     * 查询发送失败的所有消息
     * @return
     */
    @Query(nativeQuery = true,
    value = "SELECT * from mq_msg where (status=0 or status=3) and send_num <= 5")
    List<MqMsg> listNoSendSuccess();

}
